package com.example.case03_16110100424;

import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class Welcome2Activity extends AppCompatActivity {
         private TextView tv_username,tv_password;
         private Button btn_setting;
         private  SharedPreferences sp;
         private  SharedPreferences.Editor editor;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome2);
        tv_username=findViewById(R.id.tv_username);
        tv_password=findViewById(R.id.tv_password);
        btn_setting=findViewById(R.id.btn_setting);
        tv_username.setText(getIntent().getStringExtra("username"));
        tv_password.setText(getIntent().getStringExtra("password"));
        sp=getSharedPreferences("case3_sp",MODE_PRIVATE);
                editor=sp.edit();
                editor.putString("username",getIntent().getStringExtra("username"));
                editor.commit();
                View.OnClickListener listener=new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent(Welcome2Activity.this, SettingActivity.class);
                        startActivity(intent);
                    }
                };

        btn_setting.setOnClickListener(listener);

        }



}
